package com.theorydance.esoperator.utils;

import lombok.Data;

@Data
public class RefreshConf {

	private volatile long refreshTime = 0L;
	private long refreshInterval = 30*60*1000; // 刷新间隔30分钟
	private String remark; // 备注信息，根据不同的业务，里面存放的数据，自行解析
	
	public RefreshConf(){}
	
	public RefreshConf(long refreshInterval){
		this.refreshInterval = refreshInterval;
	}
	
	public long getExpired() {
		return refreshTime + refreshInterval;
	}
	
	public boolean isExpired() {
		return getExpired() < System.currentTimeMillis();
	}
	
	public void updateRefreshTime() {
		this.refreshTime = System.currentTimeMillis();
	}
	
}
